home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_01_01 / 1n01043a < prev    next >
Text File  |  1990-05-16  |  1KB  |  39 lines

  1.         PAGE ,132
  2.  
  3. ;  Figure 6
  4. ;
  5. ;  Determine if a printer is ready for use
  6.  
  7.  
  8. %       .MODEL  memodel,lang            ;Add model and language support via
  9.                                         ;command line macros, e.g.
  10.                                         ;MASM /Dmemodel=LARGE /Dlang=C
  11.  
  12.         .CODE
  13.  
  14. ;
  15. ;  Call with printer number (1-3)
  16. ;  Returns 0 if not ready, 1 if ready, -1 if error
  17. ;
  18.  
  19. PrRdy   PROC    USES DX, lptno:WORD     ;lptno = 1, 2, or 3
  20.         mov     DX,lptno                ;Get printer number
  21.         dec     DX                      ;BIOS uses 0, 1, or 2
  22.         cmp     DX,2                    ;In range?
  23.         ja      err                     ;No, return error code
  24.         mov     AH,2                    ;Yes, call BIOS to get status
  25.         int     17h
  26.         and     AH,80h                  ;Printer ready?
  27.         mov     AX,0
  28.         jz      exit                    ;No, done
  29.         inc     AX                      ;Yes, return 1
  30. exit:
  31.         ret
  32. err:
  33.         mov     AX,-1
  34.         ret
  35.  
  36. PrRdy   ENDP
  37.  
  38.         end
  39.